package creditcard.observer;

import creditcard.account.BronzeCard;
import creditcard.account.GoldCard;
import creditcard.gui.View;
import framework.account.Transaction;
import framework.observer.BaseObserver;

public class GoldCardObserver extends BaseObserver<GoldCard, Transaction> {
    private View view;

    public GoldCardObserver(View view) {
        super(GoldCard.class);
        this.view = view;
    }

    @Override
    public void updateObserver(GoldCard t, Transaction e) {
        if (e.getResult().equals("success")) {
            view.getModel().setValueAt(t.getBalance(), view.getSelection(), 4);
            System.out.println("gold card Success");
        } else
            System.out.println("Failed");
    }

    public void setView(View view) {
        this.view = view;
    }
}
